package com.lagou.rpc.consumer.config;

import org.apache.zookeeper.ZooKeeper;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Bean;

import java.io.IOException;

/**
 * @author: jie.zhao
 * @create: 2021/06/01 18:18
 */
@SpringBootConfiguration
public class BeanConfiguration {

    @Bean(name = "zookeeper")
    public ZooKeeper getZooKeeper(){
        try {
            return new ZooKeeper(
                    "localhost:2182",60000 , new ZookeeperSessionCreateSelectNode());
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}
